import React, { Component, lazy, Suspense } from "react";
import { Switch, Route } from "react-router-dom";
import Layout from '@/views/layout'

const Detail = lazy(() => import('@/views/detail'))
const Search = lazy(() => import('@/views/search'))
class Router extends Component {
  render() {
    return (
      <Suspense>
        <Switch>
          <Route path="/detail/:id" component={Detail}></Route>
          <Route path="/search" component={Search}></Route>
          <Route path="/" component={Layout}></Route>
        </Switch>
      </Suspense>
    );
  }
}

export default Router;
